package com.hhc.streamApi;

import java.util.ArrayList;
import java.util.List;

public class T {

    public static void main(String[] args) {
        List<Student> list = new ArrayList<>();
        list.add(new Student("jack", 21));
        list.add(new Student("zhangsan", 16));
        list.add(new Student("lisi", 25));
        list.add(new Student("wangwu", 14));
        list.add(new Student("zhaoyun", 21));

        /*list.stream().filter(s->s.getAge()>18)
                .collect(Collectors.toList()).forEach(System.out::println);*/
        Student[] students = list.stream().limit(3).toArray(Student[]::new);
        System.out.println(students.length);
    }
}
